//
//  SQAlarmRecordTableViewCell.m
//  energy
//
//  Created by 苏青 on 2021/9/29.
//

#import "SQAlarmRecordTableViewCell.h"

#import "SQAlarmRecordModel.h"
#import "NSString+NCDate.h"

@implementation SQAlarmRecordTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
+(CGFloat)cellHeight:(BaseModel *)model{
    return W(195);
}

-(void)setModel:(BaseModel<BaseCellModelProtocol> *)model{
    SQAlarmRecordModelData * dataModel = model;
    self.lab_apr_alarm_phone.text = dataModel.apr_alarm_phone;
    self.lab_apr_alarm_person.text = dataModel.apr_alarm_person;
    self.lab_apr_alarm_organization.text = dataModel.apr_alarm_organization;
    self.lab_apr_alarm_date.text = [NSString formateDateToDay:[dataModel.apr_alarm_date substringWithRange:NSMakeRange(6,13)]];
    self.lab_apr_receive_phone.text = dataModel.apr_receive_phone;
    self.lab_apr_receive_person.text = dataModel.apr_receive_person;
    if ([dataModel.apr_state isEqualToString:@"0"]) {
        self.lab_type.text = @"";
        self.lab_typeName.text = @"";
        self.btn_dispose.hidden = NO;
    }else if ([dataModel.apr_state isEqualToString:@"1"]){
        self.lab_typeName.text = @"报警状态:";
        self.lab_type.text = @"已处理";
        self.btn_dispose.hidden = YES;
    }else if ([dataModel.apr_state isEqualToString:@"2"]){
        self.lab_typeName.text = @"报警状态:";
        self.lab_type.text = @"误 报";
        self.btn_dispose.hidden = YES;
    }
    
}

- (IBAction)clickDispose:(UIButton *)sender {
    self.cellTitleIndex(@"dispose",(int)self.indexPath.row);
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
